﻿using UnityEngine;

public class MyData
{
    public static T loadModel<T>(string PlayerFilename)
    {
        string text = PlayerPrefs.GetString(PlayerFilename);
        T model = JsonUtility.FromJson<T>(text);
        return model;
    }

    public static void saveModel<T>(string PlayerFilename, T model)
    {
        string json = JsonUtility.ToJson(model);
        PlayerPrefs.SetString(PlayerFilename, json);
        PlayerPrefs.Save();
    }
}